#include "qupdatemanager.h"

#include "qgetfile.h"
#include "qgetversion.h"

QUpdateManager::QUpdateManager(QObject *parent) :
    QObject(parent),
    m_version(new QGetVersion),
    m_file(new QGetFile)
{
    connect(m_version,SIGNAL(finish(QByteArray)),this,SLOT(version(QByteArray)));
    connect(m_file,SIGNAL(finish()),this,SIGNAL(file_finish()));
}

QUpdateManager::~QUpdateManager()
{
    delete m_version;
}

void QUpdateManager::test_version()
{
    //m_version->start(QUrl("http://it.sinee.cn/electri_audit_docs/update_version.txt"));
}

void QUpdateManager::version(const QByteArray &data)
{
    m_version_data=data;
    emit version_finish();
}

QByteArray QUpdateManager::get_version_data()
{
    return m_version_data;
}

void QUpdateManager::start_update(const QString &path)
{
    m_file->start(QUrl(path));
}
